package com.ftg.learn.mapper;

import com.ftg.learn.dao.Peijian;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface PeijianMapper {

    @Select("select * from peijian where name like ifnull(concat(#{arg2},'%'),name) limit #{arg0},#{arg1}")
    public List<Peijian> select(int begin, int limit, String name);

    @Select("select count(*) from peijian where name like ifnull(concat(#{arg2},'%'),name)")
    int geletePeijian(String name);

    @Delete("delete from peijian where id=#{id}")
    public int delete(String id);
    @Update("update peijian set name=#{name},top=#{top},price=#{price},picture=#{picture},count=#{count},href=#{href} where id=#{id}")
    int update(Peijian peijian);
    @Insert("insert into peijian(id,name,top,price,picture,count,href) values(#{id},#{name},#{top},#{price},#{picture},#{count},#{href})")
    public int add(Peijian peijian);

    @Select("select * from peijian")
    List<Peijian> selectpicture();

}
